Kuru Kuru Fever Retail N64 Hack

  Another Aleck64 title ported to retail N64 consoles.  It's an overly-cute matching puzzle game with an interesting gimmick.  Each animal has a "favorite fruit" that, when cleared, causes the play area to flip upside down.  Subsequent matches cause further flips and reduce the number of adjacent tiles needed for a match.
  Despite the cuteness factor the game has a fairly steep difficulty curve and can get inhumanly fast at times.

  This series of patches allow a retail N64 console to run the various Aleck64 titles.  It mimics the hardware registers used for the DIP and hardware switches and pushes N64 controller output to the mahjong controller input.
  It requires an 8MB expansion pak, and optionally 4k or 16k eeprom to save settings.  Use the test menu to set game options and coin settings.  To clear room for a controller feed translation function two other functions were rewritten to reduce their size.

Controls:
+pad	movement
A	button 1
B	button 2
Start	start
L	test button
R	service button
c-down	coin slot 1
c-up	coin slot 2

Patch Application:
  Standalone patches were abandoned in favor of an autopatcher.  This requires either 64bit Windows or something compatible.
  The game was originally stored across two flashram.  You'll need to provide both ua3088-all01.u3 and ua3088-alh04.u4.  (MAME's filenames in kurufev correspond to these two ICs.)  Although these two files are natively little endian, the patcher accepts either byteorder.  They will be tested against known good SHA512s.  Incorrect or bad files will display an error.
  Select any applicable DIP switches, then output an N64-compatible ROM usable on hardware.  Output is native byteorder (big endian), using a 5101 CIC.

DIP Switch Reference:
  DIP switches are stored at 0xC00 in ROM and can be modified freely without recalculating the checksum.  Unlike most titles, DIP state is read constantly and can be toggled on/off during use--on arcade boards that is ;*)
0100	DIP SW 1	TEST MENU
			Same effect as the Test switch, opening the Test Menu.
0200	DIP SW 2	PAUSE
			Active pause current execution.  Prevents frame advance.

Additional Files:
Kurukuru Fever.txt
	A filelist containing all file offsets and their types to aid extraction.
src/diminish.txt
	Source code for the reduced functions.  Written in ASM.
src/hackery.txt
	Notes on runtime activity and other code when developing the patch.

Random Notes:
  As an interesting point, normal controller tests were implemented.  Controller reading was disabled by setting 800A6728 True when the attract screen starts running, but even when enabled the results are ignored.

Revision Log:
V1.1	‎Aug ‎31, ‎2021
	Gamma correction fix for console.  Aleck's RGB out doesn't use gamma!
	Timestamp added to header at 0x34.
	Change to (bloated) autopatching method.
	Added DIP switch reference.
V1.0	‎Feb ‎13, ‎2015
	Original Release

-Zoinkity
